package com.tdkj.action.backstage.decorate;

import java.util.List;
import javax.annotation.Resource;
import com.tdkj.action.BaseAction;
import com.tdkj.model.decorate.BeanDecorateType;
import com.tdkj.service.decorate.IBeanDecorateTypeService;


public class DecorateTypeAction extends BaseAction {
    
	private IBeanDecorateTypeService decorateTypeService;
	
	private List<BeanDecorateType> types ;
	
	private BeanDecorateType type;
	
	public String execute() {
		types = decorateTypeService.findAll(BeanDecorateType.class);
		return "success";
	}
	
	public String edit() {
		type = decorateTypeService.findById(type.getId(), BeanDecorateType.class);
		return "edit";
	}

	public String add() {
		decorateTypeService.save(type);
		return execute();
	}
	
	public String update() {
		decorateTypeService.saveOrUpdate(type, BeanDecorateType.class);
		return execute();
	}
	
	public String delete() {
		decorateTypeService.delete(type.getId(), BeanDecorateType.class);
		return execute();
	}

	public List<BeanDecorateType> getTypes() {
		return types;
	}

	public void setTypes(List<BeanDecorateType> types) {
		this.types = types;
	}

	public BeanDecorateType getType() {
		return type;
	}

	public void setType(BeanDecorateType type) {
		this.type = type;
	}

	@Resource
	public void setDecorateTypeService(IBeanDecorateTypeService decorateTypeService) {
		this.decorateTypeService = decorateTypeService;
	}
	
	
	
}
